public class 原型模式 {
    public static void main(String[] args) throws CloneNotSupportedException {
        Prototype original = new Prototype("Original");
        Prototype clone = (Prototype) original.clone();
        //clone.setName("Clone");
        System.out.println("Original Name: " + original.getName());
        System.out.println("Clone Name: " + clone.getName());
    }
}
class Prototype implements  Cloneable{
    private String name;
    public Prototype(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone(); // 默认浅拷贝
    }
}